unit Principal;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, cxLookAndFeelPainters, cxButtons, Menus, cxPC,
  cxControls;

type
  TfrmPrincipal = class(TForm)
    btnSair: TcxButton;
    sfdsd: TcxPageControl;
    cxTabSheet1: TcxTabSheet;
    btnConsulta: TcxButton;
    cxButton1: TcxButton;
    cxButton2: TcxButton;
    cxButton3: TcxButton;
    pmImpressoes: TPopupMenu;
    Compras1: TMenuItem;
    DespesasReceitasporCategoria1: TMenuItem;
    procedure FormShow(Sender: TObject);
    procedure btnConsultaClick(Sender: TObject);
    procedure cxButton1Click(Sender: TObject);
    procedure cxButton2Click(Sender: TObject);
    procedure btnSairClick(Sender: TObject);
    procedure Compras1Click(Sender: TObject);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    procedure DespesasReceitasporCategoria1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmPrincipal: TfrmPrincipal;

implementation
Uses EdDocumento, CadGerais, Documentos, ListaCompras, RelCompras, RelCategorias,
  PlanejMensal;
{$R *.dfm}

procedure TfrmPrincipal.FormShow(Sender: TObject);
begin
  frmPrincipal.Top:=10;
  frmPrincipal.Left:= (Screen.DesktopWidth - frmPrincipal.Width) DIV 2;
end;

procedure TfrmPrincipal.btnConsultaClick(Sender: TObject);
begin
  Application.CreateForm(TfrmDocumentos,frmDocumentos);
  frmDocumentos.SHowModal;
  FreeAndNil(frmDocumentos);
end;

procedure TfrmPrincipal.cxButton1Click(Sender: TObject);
begin
  Application.CreateForm(TfrmCadGerais,frmCadGerais);
  frmCadGerais.SHowModal;
  FreeAndNil(frmCadGerais);
end;

procedure TfrmPrincipal.cxButton2Click(Sender: TObject);
begin
  Application.CreateForm(TfrmPlanejMensal,frmPlanejMensal);
  frmPlanejMensal.SHowModal;
  FreeAndNil(frmPlanejMensal);
end;

procedure TfrmPrincipal.btnSairClick(Sender: TObject);
begin
  Close;
end;

procedure TfrmPrincipal.Compras1Click(Sender: TObject);
begin
  Application.CreateForm(TfrmRelCompras,frmRelCompras);
  frmRelCompras.SHowModal;
  FreeAndNil(frmRelCompras);
end;

procedure TfrmPrincipal.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  If Key = vk_F9 then begin
    btnSairClick(Sender);
  end;
end;

procedure TfrmPrincipal.DespesasReceitasporCategoria1Click(
  Sender: TObject);
begin
  Application.CreateForm(TfrmRelCategorias,frmRelCategorias);
  frmRelCategorias.SHowModal;
  FreeAndNil(frmRelCategorias);
end;

end.
